import { createSlice } from "@reduxjs/toolkit";

export const authSlice = createSlice({
  name: "auth",
  initialState: {
    token: null,
    menuList: []
  },
  reducers: {
    setToken:(state, action)=>{
        state.token = action.payload
    },
    clearToken:(state)=>{
        state.token = null
    },
    setMenu:(state,action)=>{
        state.menuList=action.payload
    }
  },
});

export const {setToken, clearToken,setMenu } = authSlice.actions;
export default authSlice.reducer;